import { Inject, Module } from '@nestjs/common';
import {TypeOrmModule} from "@nestjs/typeorm"
import {resolve} from "path"
import {ConfigModule,ConfigService} from "nestjs-config"
import { AppController } from './app.controller';
import { AppService } from './app.service';
import { UsersModule } from './users/users.module';
@Module({
  imports: [
    ConfigModule.load(resolve(__dirname,'config','**/!(*.d).{ts,js}')),
    TypeOrmModule.forRootAsync({
      useFactory:(config:ConfigService)=>config.get('database'),
      inject: [ConfigService]
    }),
    UsersModule],
  controllers: [AppController],
  providers: [AppService]
})
export class AppModule {}
